﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Framework.Platform.Components;
using Framework.Core;
using Framework.Platform.Components.UI.SplashScreen;

namespace Framework.Demo
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ISplashScreen splashScreen = new SplashScreenForm();
            splashScreen.ShowUI();
            ObjectFactory.Init();
            MainApplicationContext mainApplicationContext = ObjectFactory.GetObject("MainApplicationContext") as MainApplicationContext;
            if (splashScreen != null)
            {
                splashScreen.Dispose();
            }
            mainApplicationContext.Init();
            try
            {
                if (mainApplicationContext.ShouldRun)
                    Application.Run(mainApplicationContext);
            }
            catch
            {
            }
            finally
            {
                mainApplicationContext.Dispose();
            }
        }
    }
}
